const exec = require("../DBhelper").exec
class Goods {
    async search(req, res) {
        let gid = req.params.gid;
        let sql = "select * from goods where gstatus=1 and gid=? ;";
        let result = await exec(sql, [gid]);
        res.json({ msg: "查询成功!", data: result });
    }
    async getlist(req, res) {
        let sql = "select * from goods;";
        let result = await exec(sql, []);
        res.json({ code:1, data: result });
    }
    async getlist2(req, res) {
        let sql = "select * from goods2;";
        let result = await exec(sql, []);
        res.json({ code:1, data: result });
    }
    async search2(req, res) {
        let gid = req.params.gid;
        let sql = "select * from goods2 where gstatus=1 and gid=? ;";
        let result = await exec(sql, [gid]);
        res.json({ msg: "查询成功!", data: result });
    }
    async getimg(req,res){
        let sql="select * from img"
        let res0=await exec(sql,[])
        let sql1="select * from img1"
        let res1=await exec(sql1,[])
        let sql2="select * from img2"
        let res2=await exec(sql2,[])
        let sql3="select * from img3"
        let res3=await exec(sql3,[])
        let sql4="select * from img4"
        let res4=await exec(sql4,[])
        let sql5="select * from img5"
        let res5=await exec(sql5,[])
        let sql6="select * from img6"
        let res6=await exec(sql6,[])
        let sql7="select * from img7"
        let res7=await exec(sql7,[])
        let sql8="select * from img8"
        let res8=await exec(sql8,[])
        let sql9="select * from img9"
        let res9=await exec(sql9,[])
        let sql10="select * from img10"
        let res10=await exec(sql10,[])
        let sql11="select * from img11"
        let res11=await exec(sql11,[])
        let result=[
            res0,res1,res2,res3,res4,res5.res6,res7,res8,res9,res10,res11
        ]
        res.json({ msg: "查询成功!", data: result });
    }
}
module.exports = new Goods();
